package org.example.service.impl;

import lombok.extern.slf4j.Slf4j;
import org.example.entity.User;
import org.example.mapper.UserMapper;
import org.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 张在成
 */
@Service
@Slf4j
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    /**
     * 向用户信息表中添加信息
     * @param u
     * @return
     * @throws Exception
     */
    @Override
    public int addUser(User u) throws Exception {
        return userMapper.addUser(u);
    }

    /**
     * 查询用户信息
     * @param list
     * @return
     * @throws Exception
     */
    @Override
    public List<User> getUserListInfo(List list) throws Exception {
        return userMapper.getUserListInfo(list);
    }

    /**
     * 根据用户名查询用户信息
     * @param username
     * @return 返回用户信息
     * @throws Exception
     */
    @Override
    public User getUserByUsername(String username) throws Exception {
       User user=userMapper.selectUserByUsername(username);
        return user;
    }






}
